LL OPAMP Functions

Configuration of OPAMP hierarchical scope: OPAMP instance

group OPAMP_LL_EF_CONFIGURATION_OPAMP_INSTANCE

Functions

void LL_OPAMP_ResetConfig ( OPAMP_TypeDef * p_opamp )

Reset OPAMP CSR register, reset all bits except USERTRIM and OPA_RANGE.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPAHSM LL_OPAMP_ResetConfig

CSR CALOUT LL_OPAMP_ResetConfig

CSR USERTRIM LL_OPAMP_ResetConfig

CSR CALSEL LL_OPAMP_ResetConfig

CSR CALON LL_OPAMP_ResetConfig

CSR VP_SEL LL_OPAMP_ResetConfig

Note

The OPAMP must be disabled to change this configuration.

Parameters :

p_opamp – OPAMP instance

void LL_OPAMP_SetSpeedMode ( OPAMP_TypeDef * p_opamp , uint32_t speed_mode )

Set OPAMP speed mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR HSM LL_OPAMP_SetSpeedMode

Note

The OPAMP must be disabled to change this configuration.

Parameters :
uint32_t LL_OPAMP_GetSpeedMode ( const OPAMP_TypeDef * p_opamp )

Get OPAMP speed mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR HSM LL_OPAMP_GetSpeedMode

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetMode ( OPAMP_TypeDef * p_opamp , uint32_t mode )

Set OPAMP mode calibration or functional.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALON LL_OPAMP_SetMode

Note

OPAMP mode corresponds to functional or calibration mode:

  • functional mode: OPAMP operation in standalone, follower, … Set functional mode using function LL_OPAMP_SetConfigurationMode().

  • calibration mode: offset calibration of the selected transistors differential pair NMOS or PMOS.

Note

On this STM32 series, during calibration, OPAMP functional mode must be set to standalone or follower mode (in order to open internal connections to resistors of PGA mode). Refer to function LL_OPAMP_SetConfigurationMode().

Parameters :
uint32_t LL_OPAMP_GetMode ( const OPAMP_TypeDef * p_opamp )

Get OPAMP mode calibration or functional.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALON LL_OPAMP_GetMode

Note

OPAMP mode corresponds to functional or calibration mode:

  • functional mode: OPAMP operation in standalone, follower, … Set functional mode using function LL_OPAMP_SetConfigurationMode().

  • calibration mode: offset calibration of the selected transistors differential pair NMOS or PMOS.

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetConfigurationMode ( OPAMP_TypeDef * p_opamp , uint32_t mode )

Set OPAMP configuration mode by setting internal connections.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VM_SEL LL_OPAMP_SetConfigurationMode

Note

This function reset bit of calibration mode to ensure to be in functional mode, in order to have OPAMP parameters (inputs selection, …) set with the corresponding OPAMP mode to be effective.

Parameters :
uint32_t LL_OPAMP_GetConfigurationMode ( const OPAMP_TypeDef * p_opamp )

Get OPAMP configuration mode from setting of internal connections. OPAMP operation in standalone, follower, …

Reference Manual to LL API cross reference (Register Field Functions)

CSR VM_SEL LL_OPAMP_GetConfigurationMode

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetPGAGain ( OPAMP_TypeDef * p_opamp , uint32_t gain )

Set OPAMP PGA gain.

Reference Manual to LL API cross reference (Register Field Functions)

CSR gain LL_OPAMP_SetPGAGain

Note

Preliminarily, OPAMP must be set in mode PGA using function LL_OPAMP_SetConfigurationMode().

Parameters :
uint32_t LL_OPAMP_GetPGAGain ( const OPAMP_TypeDef * p_opamp )

Get OPAMP PGA gain.

Reference Manual to LL API cross reference (Register Field Functions)

CSR PGA_GAIN LL_OPAMP_GetPGAGain

Note

Preliminarily, OPAMP must be set in mode PGA using function LL_OPAMP_SetConfigurationMode().

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetPGAExternalMode ( OPAMP_TypeDef * p_opamp , uint32_t mode )

Set OPAMP PGA external connection configuration.

Reference Manual to LL API cross reference (Register Field Functions)

CSR PGA_GAIN LL_OPAMP_SetPGAExternalMode

Note

Preliminarily, OPAMP must be set in mode PGA using function LL_OPAMP_SetConfigurationMode().

Parameters :
uint32_t LL_OPAMP_GetPGAExternalMode ( const OPAMP_TypeDef * p_opamp )

Get OPAMP PGA external connection configuration.

Reference Manual to LL API cross reference (Register Field Functions)

CSR PGA_GAIN LL_OPAMP_GetPGAExternalMode

Note

Preliminarily, OPAMP must be set in mode PGA using function LL_OPAMP_SetConfigurationMode().

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetConfig ( OPAMP_TypeDef * p_opamp , uint32_t reg_value )

Set OPAMP in one time configuration parameters.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALON LL_OPAMP_SetConfig

CSR OPAMODE LL_OPAMP_SetConfig

CSR OPALPM LL_OPAMP_SetConfig

CSR HSM LL_OPAMP_SetConfig

CSR OPAINTOEN LL_OPAMP_SetConfig

CSR VM_SEL LL_OPAMP_SetConfig

CSR VP_SEL LL_OPAMP_SetConfig

Note

Preliminarily, OPAMP must be disabled.

Parameters :
  • p_opamp – OPAMP instance

  • reg_value – This parameter is a concatenation of bits CALON, HSM, VM_SEL, VP_SEL

uint32_t LL_OPAMP_GetConfig ( const OPAMP_TypeDef * p_opamp )

Get OPAMP configuration parameters bit fields.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALON LL_OPAMP_GetConfig

CSR OPAMODE LL_OPAMP_GetConfig

CSR OPALPM LL_OPAMP_GetConfig

CSR HSM LL_OPAMP_GetConfig

CSR OPAINTOEN LL_OPAMP_SetConfig

CSR VM_SEL LL_OPAMP_GetConfig

CSR VP_SEL LL_OPAMP_GetConfig

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value is the concatenation of bits CALON, HSM, VM_SEL, VP_SEL

Configuration of OPAMP inputs

group OPAMP_LL_EF_CONFIGURATION_INPUTS

Functions

void LL_OPAMP_SetInputNonInverting ( OPAMP_TypeDef * p_opamp , uint32_t input_non_inverting )

Set OPAMP non-inverting input connection.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VPSEL LL_OPAMP_SetInputNonInverting

Parameters :
  • p_opamp – OPAMP instance

  • input_non_inverting – This parameter can be one of the following values:

    • (1) Parameters only available on STM32C542xx/532xx devices

    • (2) Parameters only available on STM32C5P1xx/5Q1xx devices

    • (3) Parameters only available on STM32C5J1xx/5K1xx devices

uint32_t LL_OPAMP_GetInputNonInverting ( const OPAMP_TypeDef * p_opamp )

Get OPAMP non-inverting input connection.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VPSEL LL_OPAMP_GetInputNonInverting

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values: This parameter can be one of the following values:

  • (1) Parameters only available on STM32C542xx/532xx devices

  • (2) Parameters only available on STM32C5P1xx/5Q1xx devices

  • (3) Parameters only available on STM32C5J1xx/5K1xx devices

void LL_OPAMP_SetInputInverting ( OPAMP_TypeDef * p_opamp , uint32_t input_inverting )

Set OPAMP inverting input connection.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VMSEL LL_OPAMP_SetInputInverting

Note

OPAMP inverting input is used with OPAMP in mode standalone or PGA with external capacitors for filtering circuit. Otherwise (OPAMP in mode follower), OPAMP inverting input is not used (not connected to GPIO pin).

Parameters :
uint32_t LL_OPAMP_GetInputInverting ( const OPAMP_TypeDef * p_opamp )

Get OPAMP inverting input connection.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VMSEL LL_OPAMP_GetInputInverting

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetInputs ( OPAMP_TypeDef * p_opamp , uint32_t input_non_inverting , uint32_t input_inverting )

Set OPAMP both inverting input and non-inverting input connections.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VPSEL LL_OPAMP_SetInputs

CSR VMSEL LL_OPAMP_SetInputs

Note

OPAMP inverting input is used with OPAMP in mode standalone or PGA with external capacitors for filtering circuit. Otherwise (OPAMP in mode follower), OPAMP inverting input is not used (not connected to GPIO pin).

Parameters :
uint32_t LL_OPAMP_GetInputs ( const OPAMP_TypeDef * p_opamp )

Get OPAMP both non-inverting input and inverting input connection.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VPSEL LL_OPAMP_GetInputs

CSR VMSEL LL_OPAMP_GetInputs

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value is inverting input and non-inverting input both contained in an uint32_t. This bit field contains the following values inside the [31,0] bit field: VP_SEL bit [3,2] VM_SEL bit [6,5] Those parameters can be one of the following values for VP_SEL:

Configuration and operation of OPAMP trimming

group OPAMP_LL_EF_OPAMP_TRIMMING

Functions

void LL_OPAMP_SetTrimmingMode ( OPAMP_TypeDef * p_opamp , uint32_t trimming_mode )

Set OPAMP trimming mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR USERTRIM LL_OPAMP_SetTrimmingMode

Parameters :
uint32_t LL_OPAMP_GetTrimmingMode ( const OPAMP_TypeDef * p_opamp )

Get OPAMP trimming mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR USERTRIM LL_OPAMP_GetTrimmingMode

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetCalibrationSelection ( OPAMP_TypeDef * p_opamp , uint32_t transistors_diff_pair )

Set OPAMP offset to calibrate the selected transistors differential pair NMOS or PMOS.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALSEL LL_OPAMP_SetCalibrationSelection

Note

Preliminarily, OPAMP must be set in mode calibration using function LL_OPAMP_SetMode().

Parameters :
uint32_t LL_OPAMP_GetCalibrationSelection ( const OPAMP_TypeDef * p_opamp )

Get OPAMP offset to calibrate the selected transistors differential pair NMOS or PMOS.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALSEL LL_OPAMP_GetCalibrationSelection

Note

Preliminarily, OPAMP must be set in mode calibration using function LL_OPAMP_SetMode().

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

uint32_t LL_OPAMP_IsCalibrationOutputSet ( const OPAMP_TypeDef * p_opamp )

Get OPAMP calibration result of toggling output.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALOUT LL_OPAMP_IsCalibrationOutputSet

Note

Returned value is not related to CALOUT flag value: intended to monitor CALOUT flag transition and state corresponding to calibration completed (refer to calibration procedure in reference manual).

Parameters :

p_opamp – OPAMP instance

Return values :
  • 1 – If the offset is not enough compensated with the current trim offset value.

  • 0 – If the offset is enough compensated.

void LL_OPAMP_SetTrimmingValue ( OPAMP_TypeDef * p_opamp , uint32_t power_mode , uint32_t transistors_diff_pair , uint32_t trimming_value )

Set OPAMP trimming factor for the selected transistors differential pair NMOS or PMOS, corresponding to the selected power mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR TRIMOFFSETN LL_OPAMP_SetTrimmingValue

CSR TRIMOFFSETP LL_OPAMP_SetTrimmingValue

Parameters :
uint32_t LL_OPAMP_GetTrimmingValue ( const OPAMP_TypeDef * p_opamp , uint32_t power_mode , uint32_t transistors_diff_pair )

Get OPAMP trimming factor for the selected transistors differential pair NMOS or PMOS, corresponding to the selected power mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR TRIMOFFSETN LL_OPAMP_GetTrimmingValue

CSR TRIMOFFSETP LL_OPAMP_GetTrimmingValue

Parameters :
Return values :

0x1...0x1F

void LL_OPAMP_SetOffsetTrimValue ( OPAMP_TypeDef * p_opamp , uint32_t power_mode , uint32_t transistors_diff_pair , uint32_t trimming_value )

Set OPAMP trimming factor for the selected transistors differential pair NMOS or PMOS, corresponding to the selected power mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR TRIMOFFSETN LL_OPAMP_SetOffsetTrimValue

CSR TRIMOFFSETP LL_OPAMP_SetOffsetTrimValue

Parameters :
uint32_t LL_OPAMP_GetOffsetTrimValue ( const OPAMP_TypeDef * p_opamp , uint32_t power_mode , uint32_t transistors_diff_pair )

Get OPAMP trimming factor for the selected transistors differential pair NMOS or PMOS, corresponding to the selected power mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR TRIMOFFSETN LL_OPAMP_GetOffsetTrimValue

CSR TRIMOFFSETP LL_OPAMP_GetOffsetTrimValue

Parameters :
Return values :

0x1...0x1F

void LL_OPAMP_SetOffsetTrimAllValue ( OPAMP_TypeDef * p_opamp , uint32_t power_mode , uint32_t p_trim_value , uint32_t n_trim_value )

Set OPAMP all differential pair trimming (PMOS and NMOS) values for the selected power mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR TRIMOFFSETN LL_OPAMP_SetOffsetTrimAllValue

CSR TRIMOFFSETP LL_OPAMP_SetOffsetTrimAllValue

Parameters :
  • p_opamp – OPAMP instance

  • power_mode – This parameter can be one of the following values:

  • p_trim_value – 0x01…0x1F

  • n_trim_value – 0x01…0x1F

uint32_t LL_OPAMP_GetOffsetTrimAllValue ( const OPAMP_TypeDef * p_opamp , uint32_t power_mode )

Get OPAMP PMOS and NMOS differential pair trimming values for the selected power mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR TRIMOFFSETN LL_OPAMP_GetOffsetTrimAllValue

CSR TRIMOFFSETP LL_OPAMP_GetOffsetTrimAllValue

Parameters :
  • p_opamp – OPAMP instance

  • power_mode – This parameter can be one of the following values:

Return values :

Concatenation – of trimming values (value range 32 bits), each value corresponding to register bitfield PMOS and NMOS differential pair

Operation on OPAMP instance

group OPAMP_LL_EF_OPERATION

Functions

void LL_OPAMP_Enable ( OPAMP_TypeDef * p_opamp )

Enable OPAMP instance.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPAEN LL_OPAMP_Enable

Note

After enable from off state, OPAMP requires a delay to fulfill wake up time specification. Refer to device datasheet, parameter “tWAKEUP”.

Parameters :

p_opamp – OPAMP instance

void LL_OPAMP_Disable ( OPAMP_TypeDef * p_opamp )

Disable OPAMP instance.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPAEN LL_OPAMP_Disable

Parameters :

p_opamp – OPAMP instance

uint32_t LL_OPAMP_IsEnabled ( const OPAMP_TypeDef * p_opamp )

Get OPAMP instance enable state.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPAEN LL_OPAMP_IsEnabled

Parameters :

p_opamp – OPAMP instance

Return values :
  • 1 – if OPAMP is enabled.

  • 0 – if OPAMP is disabled.

void LL_OPAMP_SetInputMuxNonInvertingSecondary ( OPAMP_TypeDef * p_opamp , uint32_t input_non_inverting_sec )

Set OPAMP non-inverting input secondary connection.

Reference Manual to LL API cross reference (Register Field Functions)

TCMR VPSSEL LL_OPAMP_SetInputMuxNonInvertingSecondary

Parameters :
  • p_opamp – OPAMP instance

  • input_non_inverting_sec – This parameter can be one of the following values:

    • (1) Parameters only available on STM32C542xx/532xx devices

    • (2) Parameters only available on STM32C5P1xx/5Q1xx devices

    • (3) Parameters only available on STM32C5J1xx/5K1xx devices

uint32_t LL_OPAMP_GetInputMuxNonInvertingSecondary ( const OPAMP_TypeDef * p_opamp )

Get OPAMP non-inverting input secondary connection.

Reference Manual to LL API cross reference (Register Field Functions)

TCMR VPSSEL LL_OPAMP_GetInputMuxNonInvertingSecondary

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

  • (1) Parameters only available on STM32C542xx/532xx devices

  • (2) Parameters only available on STM32C5P1xx/5Q1xx devices

  • (3) Parameters only available on STM32C5J1xx/5K1xx devices

void LL_OPAMP_SetInputMuxInvertingSecondary ( OPAMP_TypeDef * p_opamp , uint32_t input_inverting_sec )

Set OPAMP inverting input secondary connection.

Reference Manual to LL API cross reference (Register Field Functions)

TCMR VMSSEL LL_OPAMP_SetInputMuxInvertingSecondary

Note

OPAMP inverting input is used with OPAMP in mode standalone or PGA with external capacitors for filtering circuit. Otherwise (OPAMP in mode follower), OPAMP inverting input is not used (not connected to GPIO pin).

Note

Timer-controlled secondary mode has constraints from timer-controlled primary mode, therefore function LL_OPAMP_SetConfigurationMode() must be called prior to this function.

Parameters :
uint32_t LL_OPAMP_GetInputMuxInvertingSecondary ( const OPAMP_TypeDef * p_opamp )

Get OPAMP inverting input secondary connection.

Reference Manual to LL API cross reference (Register Field Functions)

TCMR VMSSEL LL_OPAMP_GetInputMuxInvertingSecondary

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetInputsMuxSecondary ( OPAMP_TypeDef * p_opamp , uint32_t input_non_inverting_sec , uint32_t input_inverting_sec )

Set OPAMP both inverting input and non-inverting input secondary connections.

Reference Manual to LL API cross reference (Register Field Functions)

TCMR VPSSEL LL_OPAMP_SetInputsMuxSecondary

TCMR VMSSEL LL_OPAMP_SetInputsMuxSecondary

Note

OPAMP inverting input secondary is used with OPAMP in mode standalone or PGA with external capacitors for filtering circuit. Otherwise (OPAMP in mode follower), OPAMP inverting input is not used (not connected to GPIO pin).

Parameters :
void LL_OPAMP_SetMuxInputCtrl ( OPAMP_TypeDef * p_opamp , uint32_t mux_inputs_ctrl )

Set OPAMP inputs multiplexer mode.

Reference Manual to LL API cross reference (Register Field Functions)

TCMR TCMEN LL_OPAMP_SetMuxInputCtrl

Parameters :
uint32_t LL_OPAMP_GetMuxInputCtrl ( const OPAMP_TypeDef * p_opamp )

Get OPAMP inputs multiplexer mode.

Reference Manual to LL API cross reference (Register Field Functions)

TCMR TCMEN LL_OPAMP_GetMuxInputCtrl

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

  • (1) Parameters only available on STM32C5P1xx/5Q1xx devices

  • (2) Parameters only available on STM32C5J1xx/5K1xx devices

void LL_OPAMP_SetPGAGainMuxSecondary ( OPAMP_TypeDef * p_opamp , uint32_t gain_secondary )

Set OPAMP PGA secondary gain.

Reference Manual to LL API cross reference (Register Field Functions)

TCMR PGAS_GAIN LL_OPAMP_SetPGAGainMuxSecondary

Note

Preliminarily, OPAMP must be set in mode PGA using function LL_OPAMP_SetConfigurationMode().

Parameters :
uint32_t LL_OPAMP_GetPGAGainMuxSecondary ( const OPAMP_TypeDef * p_opamp )

Get OPAMP PGA gain.

Reference Manual to LL API cross reference (Register Field Functions)

TCMR PGAS_GAIN LL_OPAMP_GetPGAGainMuxSecondary

Note

Preliminarily, OPAMP must be set in mode PGA using function LL_OPAMP_SetConfigurationMode().

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetMuxPGAGainCtrl ( OPAMP_TypeDef * p_opamp , uint32_t mux_pga_ctrl )

Set OPAMP multiplexer PGA gain.

Reference Manual to LL API cross reference (Register Field Functions)

TCMR TIMPGA_SEL LL_OPAMP_SetMuxPGAGainCtrl

Parameters :
uint32_t LL_OPAMP_GetMuxPGAGainCtrl ( const OPAMP_TypeDef * p_opamp )

Get OPAMP multiplexer PGA gain.

Reference Manual to LL API cross reference (Register Field Functions)

TCMR TIMPGA_SEL LL_OPAMP_GetMuxPGAGainCtrl

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

  • (1) Parameters only available on STM32C5P1xx/5Q1xx devices

  • (2) Parameters only available on STM32C5J1xx/5K1xx devices

  • (3) Parameters only available on STM32C542xx/532xx devices

void LL_OPAMP_SetOutputConnection ( OPAMP_TypeDef * p_opamp , uint32_t opamp_out )

Set the output connection for OPAMP instance.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPAINTOEN LL_OPAMP_SetOutputConnection

Parameters :
  • p_opamp – OPAMP instance

  • opamp_out – This parameter can be one of the following values:

    • LL_OPAMP_OUTPUT_CONNECT_EXTERNAL

    • LL_OPAMP_OUTPUT_CONNECT_INTERNAL

uint32_t LL_OPAMP_GetOutputConnection ( const OPAMP_TypeDef * p_opamp )

Get the current output connection state for OPAMP instance.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPAINTOEN LL_OPAMP_GetOutputConnection

Parameters :

p_opamp – OPAMP instance

Return values :
  • LL_OPAMP_OUTPUT_CONNECT_EXTERNAL – if the output is connected to the OPAMP_VOUT pin.

  • LL_OPAMP_OUTPUT_CONNECT_INTERNAL – if the output is connected internally to an ADC/COMP channel.